<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/5/16
 * Time: 17:49
 */
namespace app\install\controller;
use think\Controller;

class Index extends Controller{
    public function index(){
        $foenp = fopen("./lock.txt","a+");
        $content = file_get_contents("./lock.txt");
        if(!empty($content)){
            $msg = '已经成功安装了phpbloger，请不要重复安装!';
            $this->error($msg,url('install/index/complete'));
        }
        return view('index');
    }
    public function complete(){
        $step = session('step');
        if(!$step){
            $this->redirect('index');
        } elseif($step != 3) {
            $this->redirect("Install/step{$step}");
        }
        // 写入安装锁定文件
       $foenp = fopen("./lock.txt.","w");
        //写入
        fwrite($foenp, 'lock');
        session('step', null);
        session('error', null);
        session('update',null);
        return view('complete');
    }
}